test: update test values#13260
Merged
Merged
Conversation
The `docs/types/test.ts` smoke test invoked `pkg2related( 'base.sin' )`, passing an alias literal, but per source (`lib/main.js` and the JSDoc `@param`) the function accepts a package name (internal or standalone). Six of the eight sibling packages in `@stdlib/namespace` pass an argument literal that matches their documented `@param` type; `pkg2related` inherited an alias-style literal from `alias2related`. The `$ExpectType` and `$ExpectError` assertions are unchanged.
The `docs/types/test.ts` smoke test invoked `standalone2pkg( 'base.sin' )`, passing an alias literal, but per source (`lib/main.js` and the JSDoc `@param`) the function accepts a standalone package name (e.g., `@stdlib/math-base-special-sin`). Six of the eight sibling packages in `@stdlib/namespace` pass an argument literal that matches their documented `@param` type; `standalone2pkg` inherited an alias-style literal. The `$ExpectType` and `$ExpectError` assertions are unchanged.
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
approved these changes
Jul 4, 2026
namespace/pkg2related and namespace/standalone2pkg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request:
docs/types/test.tsfiles of@stdlib/namespace/pkg2relatedand@stdlib/namespace/standalone2pkgto match each function's documented@paraminput type.Namespace summary
@stdlib/namespacepackage.jsonshape/scripts/stdlibkeys,manifest.jsonpresence, README heading list, README## Usage/## Notesbodies,docs/repl.txtbodies,docs/types/index.d.tsshape,docs/types/test.tssmoke-test argument literal,docs/usage.txtandetc/cli_opts.jsonshape,bin/clistructure,lib/index.jsre-export style,lib/main.jspublic signature, validation prologue, error construction, and dependency set.package.jsontop-level key set (100%);scriptskey set (100%, all empty); file-tree entriesREADME.md,LICENSE,package.json,bin/cli,benchmark/benchmark.js,examples/index.js,lib/index.js,lib/main.js,docs/repl.txt,docs/types/index.d.ts,docs/types/test.ts,docs/usage.txt,etc/cli_opts.json,test/test.cli.js,test/test.js,datapackage.json,scripts/build.js,data/data.json(all 100%);docs/usage.txtandetc/cli_opts.jsonbodies (100%);errorConstruction: format(100%);validationPrologue: [!isString → TypeError via format](100%);returnKind: value(100%);jsdocShape.throwsTags: [{type: TypeError}](100%);docs/types/test.tssmoke-test argument matches the function's@paramtype (6/8 = 75%).## Notes, but the two packages that carry it (pkg2alias,pkg2related) genuinely document dual-format input support and were ruled intentional; keyword arrays (variation follows semantic role —aliasesis a dataset package,standalone*packages tagstandalone);data/data.csvvsdata/data.txt(semantic — mapping vs list);lib/index.jsre-export variable name (7/8 use the function name,aliasesusesmain; the modern convention ismain, so the numeric majority is legacy drift, not a target).Per outlier package
@stdlib/namespace/pkg2relatedpkg2relatedindocs/types/test.tsinvokes the function with'base.sin', an alias rather than the package name its@param pkgdocuments. Replace both occurrences with'@stdlib/math/base/special/sin', matching the literal already used inpkg2aliasandpkg2standaloneat the same call site.$ExpectTypeand$ExpectErrorassertions are untouched; only the string literal changes.@stdlib/namespace/standalone2pkgdocs/types/test.tsinvokedstandalone2pkg( 'base.sin' )andstandalone2pkg( 'base.sin', 'beep' ), passing an alias where@param pkgdocuments a standalone package name. Replace both literals with'@stdlib/math-base-special-sin', matching the## Usageexample in the README.$ExpectTypeand$ExpectErrorassertions still exercisestring; no runtime code, tests, or examples change.Validation
Checked:
package.jsonshape, README section list and body per section,docs/repl.txtbody,docs/types/index.d.tsshape,docs/types/test.tsshape,docs/usage.txt/etc/cli_opts.jsonbodies,bin/clistructure, and test/benchmark/example filenames).lib/main.jsandlib/index.jsfiles (public signature, return kind, validation prologue, error construction, JSDoc shape, dependency set fromrequirecalls)._tools/remark/plugins/remark-stdlib-related/lib/transformer.js) derives package names fromfile.dirname, not fromtest.tsliterals; confirmed no eslint rule inspects literal values; confirmed the siblingpkg2alias/pkg2standalonetest.tsfiles already use the target literal in the same call position.@stdlib/namespaceor proposes the same fix.Deliberately excluded:
pkg2related'slib/main.jsreturnsPKG_TO_RELATED[ pkg ](no.slice()) in thestandalone2pkgfallback branch while returningPKG_TO_RELATED[ pkg ].slice()in the primary branch — this is a real defensive-copy bug, but the fix would change observable behavior (a caller mutating the returned array would no longer mutate the internal table) and is therefore out of scope for a drift-detection routine restricted to mechanical, behavior-preserving fixes. Logged in the local drift report for follow-up.## Notessection onpkg2aliasandpkg2related— semantically justified (documents dual-format input support delegated throughstandalone2pkg), not drift.data/data.csvvsdata/data.txt— semantic difference (mapping vs list), not drift.lib/index.jsre-export variable name (7/8 use function name,aliasesusesmain) — the numeric majority is the legacy convention and applying it would regressaliasestoward older style.See AlsoREADME sections — auto-populated generator artifact per the invariant.Related Issues
No.
Questions
No.
Other
Random namespace pick, seed
2616902172. Eligibility criteria: ≥8 non-autogenerated direct child packages underlib/node_modules/@stdlib/; 123 candidate namespaces qualified. The chosen namespace had 8 members, none autogenerated. Full per-feature drift report saved locally alongside the run.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code running a cross-package drift-detection routine: the namespace (
@stdlib/namespace) was picked at random (seed2616902172), structural and semantic features were extracted for every member, majority patterns were computed at a 75% conformance threshold, and an independent adversarial verification agent confirmed each correction before it was applied. Only the twodocs/types/test.tsfiles inpkg2relatedandstandalone2pkgwere changed — mechanical string-literal substitution to match each function's documented@paramtype.@stdlib-js/reviewers
Generated by Claude Code